<?php


/****************************
 * 
 * 
 * 
 * 			DEPRECATED !
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 */
// Fixea un bug. Con oracle los nombre de las columnas deben ser en mayuscula.
class Ext_Paginator_Adapter_DbSelect extends Zend_Paginator_Adapter_DbSelect
{
    /**
     * Name of the row count column
     *
     * @var string
     */
    const ROW_COUNT_COLUMN = 'ZEND_PAGINATOR_ROW_COUNT';
    
    public function setRowCount($rowCount)
    {
        if ($rowCount instanceof Zend_Db_Select) {
            $result = $rowCount->query()->fetch();
            if ( count($result) == 0 ) {
                $this->_rowCount = 0;
            } else {
                $r = array_values($result);
                $this->_rowCount = $r[0];
            }
        } else if (is_integer($rowCount)) {
            $this->_rowCount = $rowCount;
        } else {
            throw new Zend_Paginator_Exception('Invalid row count');
        }

        return $this;
    }
}
